package o;

import android.annotation.SuppressLint;
import android.content.Context;
import android.content.Intent;
import java.io.UnsupportedEncodingException;
import java.security.GeneralSecurityException;

public final class epr {
    private static epr ˊ;
    private static final String ˋ = epr.class.getSimpleName();
    private static final Object ˎ = new Object();
    private static final byte[] ˏ = new byte[0];
    private String ʻ = null;
    private String ʼ = null;
    private String ʽ;
    private String ˊॱ = null;
    private long ˋॱ = 0;
    private int ˏॱ = -1;
    private int ͺ = -1;
    private final eui ॱ = new eui("DeviceSessionV4");
    private String ॱˊ;
    private String ॱॱ;
    private String ᐝ = null;

    private epr(Context context) {
    }

    public static epr ˎ() {
        epr o_epr;
        synchronized (ˎ) {
            if (ˊ == null) {
                ˊ = new epr(ContentManager.getInstant().getContext());
            }
            o_epr = ˊ;
        }
        return o_epr;
    }

    public int ˋ() {
        return this.ॱ.ॱ("appstore.client.version.code.param", -1);
    }

    public void ॱ(int i) {
        this.ॱ.ʼॱ().putInt("appstore.client.version.code.param", i).commit();
    }

    public String ˏ() {
        return this.ʽ;
    }

    public void ˎ(String str) {
        this.ʽ = str;
    }

    public String ॱ() {
        String str;
        synchronized (ˏ) {
            if (this.ॱॱ == null) {
                this.ॱॱ = this.ॱ.ॱ("appstore.aes.iv.param", null);
                if (this.ॱॱ == null) {
                    this.ॱॱ = dnk.ˏ(evh.ˋ());
                    this.ॱ.ˋ("appstore.aes.iv.param", this.ॱॱ);
                }
            }
            str = this.ॱॱ;
        }
        return str;
    }

    public String ˊ() {
        String str;
        synchronized (ˏ) {
            if (this.ॱˊ == null) {
                this.ॱˊ = this.ॱ.ॱ("appstore.seed.salt.param", null);
                if (this.ॱˊ == null) {
                    this.ॱˊ = dnk.ˏ(evh.ˎ());
                    this.ॱ.ˋ("appstore.seed.salt.param", this.ॱˊ);
                }
            }
            str = this.ॱˊ;
        }
        return str;
    }

    public String ʻ() {
        String ॱ;
        synchronized (ˏ) {
            if (this.ʼ == null) {
                ॱ = this.ॱ.ॱ("appstore.work.secret.key.param", null);
                String ॱ2 = this.ॱ.ॱ("appstore.work.iv.key.param", null);
                if (!(ॱ == null || ॱ2 == null)) {
                    this.ʼ = eux.ˏ(ॱ, evh.ˏ(), dnk.ˎ(ॱ2));
                }
                if (this.ʼ == null || this.ʼ.length() < 32) {
                    this.ʼ = doj.ˋ();
                    byte[] ˋ = evh.ˋ();
                    try {
                        ॱ = eux.ॱ(this.ʼ, evh.ˏ(), ˋ);
                    } catch (GeneralSecurityException e) {
                        Logger.e(ˋ, "getWorkSecretKey AESBaseEncrypt GeneralSecurityException error.");
                    } catch (UnsupportedEncodingException e2) {
                        Logger.e(ˋ, "getWorkSecretKey AESBaseEncrypt UnsupportedEncodingException error.");
                    }
                    this.ॱ.ˋ("appstore.work.secret.key.param", ॱ);
                    this.ॱ.ˋ("appstore.work.iv.key.param", dnk.ˏ(ˋ));
                }
            }
            ॱ = this.ʼ;
        }
        return ॱ;
    }

    @SuppressLint({"TrulyRandom"})
    public String ʽ() {
        String str;
        synchronized (ˏ) {
            if (this.ʻ == null) {
                this.ʻ = this.ॱ.ˊ("appstore.secret.key.param", null);
                if (this.ʻ == null || this.ʻ.length() < 32) {
                    this.ʻ = ˊ("appstore.secret.key.param");
                    this.ˋॱ = System.currentTimeMillis();
                }
            }
            str = this.ʻ;
        }
        return str;
    }

    @SuppressLint({"TrulyRandom"})
    private String ˊ(String str) {
        String ˋ = doj.ˋ();
        this.ॱ.ˏ(str, ˋ);
        return ˋ;
    }

    public String ᐝ() {
        try {
            return dnk.ˏ(doh.ˊ(ʽ().getBytes("UTF-8"), "30820122300D06092A864886F70D01010105000382010F003082010A0282010100BC7FE63C76D3854E930178CE25023738A0F8DFB41B795F8281B69B0E37EF253908A229ECAEAD7F53374F024EFEB8F7A77ABC94BA57F27F6C6886952AF8BEACF6B73A0B1BDB565A505C1BDD9070B4E73A2541174862429AE07071D5D96D37C212F13C323CC263E05E71F8BB1DE112A69CBDE37B042D9C64FC04FD9B69ED3C5D60CF79AA35AE0A544F52CD7762856B930DE7B945ED9DA17559F1E2E0D3172695794FECEFB1FD267F4F89B6A279BB77919312195C91A85974AD9DF74C35B0F068186189806C4FF2A9E238E63BCC7C76B943A0FF6C20C79889006C55B6D2F740DE1811E28E77C93E57E01D28F627876DB0C42C8834B172A3EB354C779F10E6312CA50203010001"));
        } catch (Exception e) {
            Logger.e(ˋ, "getEncryptKey() error");
            return null;
        }
    }

    public int ʼ() {
        return this.ॱ.ॱ("appstore.devic.is.pad.param", 0);
    }

    public void ˋ(int i) {
        this.ॱ.ʼॱ().putInt("appstore.devic.is.pad.param", i).commit();
    }

    public boolean ॱॱ() {
        if (-1 == this.ˏॱ) {
            this.ˏॱ = ˎ().ʼ();
        }
        if (this.ˏॱ == 1) {
            return true;
        }
        if (-1 == this.ͺ) {
            int i;
            if (epw.ˋ()) {
                i = 1;
            } else {
                i = 0;
            }
            this.ͺ = i;
        }
        if (this.ͺ != 1) {
            return false;
        }
        return true;
    }

    public String ॱˊ() {
        return this.ˊॱ;
    }

    public void ॱ(String str) {
        this.ˊॱ = str;
    }

    public String ˊॱ() {
        return this.ॱ.ॱ("appstore.service.zone", "");
    }

    public void ˋ(String str) {
        this.ॱ.ˋ("appstore.service.zone", str);
        ll.ˏ(ContentManager.getInstant().getContext()).ˋ(new Intent("com.huawei.appmarket.oobe.ACTION_CHECK_SERVICE_ZONE"));
    }
}
